﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace LyalinSamples.WP7Client.Themes
{
    public class ThemeDetection
    {
        public enum WP7Theme { None, Black, White, Unknown };

        public string GetActiveTheme()
        {
            WP7Theme _DetectedTheme;
            string output = string.Empty;

            // Figure out theme
            SolidColorBrush selectedBrush = (SolidColorBrush)Application.Current.Resources["PhoneBackgroundBrush"];

            if (selectedBrush.Color.Equals(Colors.White))
            {
                _DetectedTheme = WP7Theme.White;

            }
            else if (selectedBrush.Color.Equals(Colors.Black))
            {
                _DetectedTheme = WP7Theme.Black;
            }
            else
            {
                _DetectedTheme = WP7Theme.Unknown;
            }

            // Return a string representation of the detected theme
            return _DetectedTheme.ToString();
        }
    }
}
